﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace BLO
{
    /// <summary>
    /// Summary description for Theme
    /// </summary>
    public class Theme
    {
        DTO.Theme info;
        DAO.Theme themeDAO;

        public Theme()
        {
            this.themeDAO = new DAO.Theme();
            this.info = new DTO.Theme();
        }

           /// <summary>
        /// Theme Information.
        /// </summary>
        public DTO.Theme Info
        {
            get { return this.info; }
            set { this.info = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="ID"></param>
        public static Theme GetTheme(String ID)
        {
            DAO.Theme themeDAO = new DAO.Theme();
            Theme theme = new  Theme();
            theme.Info = themeDAO.GetTheme(ID);
            return theme;
        }

        /// <summary>
        /// Insert Theme information to database.
        /// </summary>
        public int Insert()
        {
            return themeDAO.InsertTheme(this.info);
        }

        /// <summary>
        /// Update information to database.
        /// </summary>
        public int Update()
        {
            return themeDAO.UpdateTheme(this.info);
        }

        /// <summary>
        /// Re-get all information from database about this Themes.
        /// </summary>
        public void Refresh()
        {
            this.info = themeDAO.GetTheme(this.info.ID.ToString());
        }

        /// <summary>
        /// Delete this news from database.
        /// </summary>
        public int Delete()
        {
            return themeDAO.DeleteTheme(this.info);
        }
    }
}